<!-- v-for 循环-->
<!-- v-on 简写为 @ -->
<!-- v-model 双向绑定-->
<!-- v-bind 传值-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./vue.js"></script>
</head>
<body>
  <div id="app">
    <input type="text" v-model="submitValue">
    <button @click='submit'>submit</button>
    <ul>
      <!-- <li v-for='item in liList'>{{item}}</li> -->
      <todo-item :content='item' v-for='item in liList'></todo-item>
    </ul>
  </div>

  <script>
    // 组件化思想，将列表项拆分为组件
    Vue.component('TodoItem',{
      props:['content'],
      template:"<li>{{content}}</li>"
    })

    let app=new Vue({
      el:"#app",
      data:{
        liList:['1','2'],
        submitValue:''
      },
      methods:{
        submit:function(){
          this.liList.push(this.submitValue)
          this.submitValue=''
        }
      }
    })
  </script>
</body>
</html>